package com.huluobo.high3videoproject.adapter;

import android.view.View;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.huluobo.high3videoproject.R;
import com.huluobo.high3videoproject.bean.VideoBeanResult;
import com.huluobo.high3videoproject.utils.GlideUtils;
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer;

import java.util.List;

public class SearchAdapter extends BaseQuickAdapter<VideoBeanResult.VideoBean, BaseViewHolder> {
    public SearchAdapter(@Nullable List<VideoBeanResult.VideoBean> data) {
        super(R.layout.item_search, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, VideoBeanResult.VideoBean videoBean) {
        GlideUtils.load(getContext(), baseViewHolder.getView(R.id.item_search_icon_iv), videoBean.getHeadpath(), 0, 0
                , 20);
        baseViewHolder.setText(R.id.item_search_name_tv, videoBean.getAuthname());
        StandardGSYVideoPlayer standardGSYVideoPlayer = baseViewHolder.getView(R.id.item_search_player);
        standardGSYVideoPlayer.setUp(videoBean.getVideopath(), true, videoBean.getCaption());
        ImageView imageView = new ImageView(getContext());
        GlideUtils.loadNormal(getContext(), imageView, videoBean.getVideomainimg());
        standardGSYVideoPlayer.setThumbImageView(imageView);
        standardGSYVideoPlayer.getBackButton().setVisibility(View.GONE);
    }
}
